package com.wyh.filemanager.model;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

import com.wyh.filemanager.FileManagerApp;
import com.wyh.log.MyLog;

public class SettingUtil {
	private static final String TAG = "SettingUtil";

	private static SettingUtil mInstanse;

	public static SettingUtil getInstanse() {
		if (mInstanse == null) {
			mInstanse = new SettingUtil();
		}
		return mInstanse;
	}

	private Context mContext;

	private boolean mShowHiddenFile;
	private boolean mShowSystemSpace;

	private SettingUtil() {
		MyLog.debug(TAG, "SettingUtil");
		mContext = FileManagerApp.getInstance().getBaseContext();

		initData();
	}

	public void initData() {

		SharedPreferences sp = PreferenceManager
				.getDefaultSharedPreferences(mContext);
		mShowHiddenFile = sp.getBoolean("showhiddenfile", false);
		mShowSystemSpace = sp.getBoolean("showsystemspace", false);

		MyLog.debug(TAG, "initData  (mShowHiddenFile = " + mShowHiddenFile
				+ "  mShowSystemSpace = " + mShowSystemSpace + ")");
	}

	public boolean isShowHiddenFile() {
		return mShowHiddenFile;
	}

	public boolean isShowSystemSpace() {
		return mShowSystemSpace;
	}
}
